package vypocty;

import riadenie.*;

public class VypocetSinusu {

	   public int zaciatok, koniec;
	   public int x1, j;
	   public double x, radiany, y1, max, min, faza, radianFaza;
	   public double a, b, radiancx, radiand;
	   Parametre p  = null; 
	   
	   public VypocetSinusu(int zaciatok, int koniec, Parametre p){   
         max = 0.0;
         min = 0.0;
         this.p = p;
         this.zaciatok = zaciatok;
         this.koniec = koniec;
         zistiMaxAMin();
	   }
	   void zistiMaxAMin() {		   
	      for(int j = zaciatok; j < koniec; j++){
	          ziskajSur(j, 0);
	          if(y1 > max){
	              max = y1;
	          }  
	          if(y1 < min){
	              min = y1;
	          }   
	       } 
	   }
	   public void ziskajSur(int i, int k) {

	      x1 = i;
	      x = (double) i;
	      faza = (double) k;
      
	      a = p.getA();
	      b = (double) (p.getB());
	      radiancx = Math.toRadians((p.getC() * x));
	      radiand = Math.toRadians(p.getD());
	      y1 = a * Math.pow(Math.sin(radiancx + radiand), b);
	      
	  //    y1 += Math.cos(Math.toRadians(2.0 * i));

	   }   
}
